package com.xbongbong.parent.interfaces;

import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.dto.FormDataUpdateDTO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.pro.formdata.pojo.vo.BeforeUpdateVO;
import com.xbongbong.pro.formdata.pojo.vo.UpdateVO;

import java.util.Map;

/**
 * @author 吴峰
 * @date 2022/01/11 9:39
 */
public interface BusinessUpdateAfterService<F, D> {

    /**
     * 保存文件柜
     * @param explainMap
     * @param paasFormDataEntity
     * @param businessType
     * @param userVO
     * @throws XbbException
     */
    void saveFile(Map<String, FieldAttrEntity> explainMap, D paasFormDataEntity, Integer businessType, UserVO userVO) throws XbbException;
    /**
     * 更新后保存日志
     * @param formDataUpdateDTO
     * @param paasFormEntity 表单实体
     * @param newPaasFormDataEntity 更新后数据
     * @param oldPaasFormDataEntity 更新前数据
     * @param updateVO
     * @param beforeUpdateVO
     * @return void
     * @author 吴峰
     * @date 2021/2/23 16:03
     * @throws XbbException
     */
    void afterSaveLog(FormDataUpdateDTO formDataUpdateDTO,F paasFormEntity, D newPaasFormDataEntity, D oldPaasFormDataEntity, UpdateVO updateVO, BeforeUpdateVO beforeUpdateVO) throws XbbException;

    /**
     * 发起 api
     * @param formDataUpdateDTO
     * @param updateVO
     * @param beforeUpdateVO
     * @throws XbbException
     */
    void apiHook(FormDataUpdateDTO formDataUpdateDTO, UpdateVO updateVO, BeforeUpdateVO beforeUpdateVO) throws XbbException;


    /**
     * 低代码
     * @param formDataUpdateDTO
     * @param updateVO
     * @param beforeUpdateVO
     * @throws XbbException
     */
    void lowCodeExecuteService(FormDataUpdateDTO formDataUpdateDTO, UpdateVO updateVO, BeforeUpdateVO beforeUpdateVO) throws XbbException;

    /**
     * 执行业务规则
     * @param formDataUpdateDTO
     * @param beforeUpdateVO
     * @param updateVO
     * @throws XbbException
     */
    void activeRule(FormDataUpdateDTO formDataUpdateDTO, BeforeUpdateVO beforeUpdateVO, UpdateVO updateVO) throws XbbException;
}
